package com.mt.demo.controller;


import com.mt.demo.domain.AjaxResult;
import com.mt.demo.domain.MtMemberDetail;
import com.mt.demo.domain.TableDataInfo;
import com.mt.demo.service.IMtMemberDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 成员进出明细Controller
 * 
 * @author gary
 * @date 2025-08-11
 */
@RestController
@RequestMapping("/mt/memberDetail")
public class MtMemberDetailController extends BaseController
{
    @Autowired
    private IMtMemberDetailService mtMemberDetailService;

    /**
     * 查询成员进出明细列表
     */
    @GetMapping("/list")
    public TableDataInfo list(MtMemberDetail mtMemberDetail)
    {
        startPage();
        List<MtMemberDetail> list = mtMemberDetailService.selectMtMemberDetailList(mtMemberDetail);
        return getDataTable(list);
    }

    /**
     * 导出成员进出明细列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, MtMemberDetail mtMemberDetail)
    {
        List<MtMemberDetail> list = mtMemberDetailService.selectMtMemberDetailList(mtMemberDetail);
//        ExcelUtil<MtMemberDetail> util = new ExcelUtil<MtMemberDetail>(MtMemberDetail.class);
//        util.exportExcel(response, list, "成员进出明细数据");
    }

    /**
     * 获取成员进出明细详细信息
     */
    @GetMapping(value = "/{detailId}")
    public AjaxResult getInfo(@PathVariable("detailId") Long detailId)
    {
        return success(mtMemberDetailService.selectMtMemberDetailByDetailId(detailId));
    }

    /**
     * 新增成员进出明细
     */
    @PostMapping
    public AjaxResult add(@RequestBody MtMemberDetail mtMemberDetail)
    {
        return toAjax(mtMemberDetailService.insertMtMemberDetail(mtMemberDetail));
    }

    /**
     * 修改成员进出明细
     */
    @PutMapping
    public AjaxResult edit(@RequestBody MtMemberDetail mtMemberDetail)
    {
        return toAjax(mtMemberDetailService.updateMtMemberDetail(mtMemberDetail));
    }

    /**
     * 删除成员进出明细
     */
	@DeleteMapping("/{detailIds}")
    public AjaxResult remove(@PathVariable Long[] detailIds)
    {
        return toAjax(mtMemberDetailService.deleteMtMemberDetailByDetailIds(detailIds));
    }
}
